'\"macro stdmacro
.\"
.\" Copyright (c) 2020 Red Hat.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.\"
.TH PMSEARCHTEXTSUGGEST 3 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmSearchTextSuggest\f1 \- search for suggestions of metric or instance names using PCP search services
.SH "C SYNOPSIS"
.ft 3
#include <pcp/pmwebapi.h>
.sp
int pmSearchTextSuggest(pmSearchSettings *\fIsettings\fP, pmSearchTextRequest *\fIrequest\fP, void *\fIarg\fP)
.sp
cc ... \-lpcp_web
.ft 1
.SH DESCRIPTION
Executes fulltext search for names of metrics or instances suitable for autocompletition, specified by
.IR request :
.TP 5
\fIquery\fR
Query string that will be used to search.
.TP 5
\fIcount\fR
Limits number of results. Defaults to 10.
.PP
Words with length less than 2 are omitted.
.PP
This search matches terms inside entity name that either have
.B query
prefix or are within Levenshtein distance of 1, with former having slightly higher priority than the latter.
.PP
Each entity matched by the
.B request
above will be passed to
.B on_text_result
callback provided by
.B settings.
.SH DIAGNOSTICS
This function always returns zero on success.
On failure a negative PMAPI error code is returned.
.SH SEE ALSO
.BR pmproxy (1),
.BR pmlogger (1),
.BR pmsearch (1),
.BR redis-server (1),
.BR pmSearchSetup (3),
.BR PMAPI (3)
and
.BR PMWEBAPI (3).

